﻿using System;
using System.Collections.Generic;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using FineUI;
using System.Text;
using System.Linq;
using System.Data.Entity;
using ZHDJ.Data.Models.Box;
using ZHDJ.WebPage;
using PageBase = AppBox.BLL.PageBase;
using ZHDJ.Data.Models.Org;

namespace AppBox.admin
{
    public partial class user_view : BLL.PageBase
    {
        #region ViewPower

        /// <summary>
        /// 本页面的浏览权限，空字符串表示本页面不受权限控制
        /// </summary>
        public override string ViewPower
        {
            get
            {
                return "CoreUserView";
            }
        }

        #endregion

        #region Page_Load

        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                LoadData();
            }
        }

        private void LoadData()
        {
            btnClose.OnClientClick = ActiveWindow.GetHideReference();

            string id = GetQueryIntValue("id");

            IQueryable<PartyOrgMember> q = DB.PartyOrgMembers;
            q = q.Where(m => m.ID == id);

            PartyOrgMember currMember = q.FirstOrDefault();
            if (currMember == null)
            {
                // 参数错误，首先弹出Alert对话框然后关闭弹出窗口
                Alert.Show("参数错误！", String.Empty, ActiveWindow.GetHideReference());
                return;
            }

            labUserNo.Text = currMember.UserNo;
            labEducationa.Text = currMember.Educational;
            labUserName.Text = currMember.UserName;
            labGender.Text = currMember.Gender == "0" ? "男" : "女";
            labIdentityCard.Text = currMember.IdentityCard;
            labBirthday.Text = currMember.MobileNo;
            labAddress.Text = currMember.Birthday == null ? "" : currMember.Birthday.ToString().Replace("00:00:00", "");
            labHukouPlace.Text = currMember.HukouPlace;
            labNativePlace.Text = currMember.NativePlace;
            labNation.Text = currMember.Nation;
            labWorkUnit.Text = currMember.WorkUnit;
            labUnitJob.Text = currMember.UnitJob;
        }

        #endregion

    }
}
